package com.getpebble.android.notifications.model.apps;

import android.content.Context;
import com.getpebble.android.common.core.trace.Trace;
import com.getpebble.android.notifications.model.PblNotification;
import java.util.ArrayList;
import java.util.Arrays;

public class MergedMessagesNotificationExtrator extends NotificationExtractor {
    public static final ArrayList<String> MESSAGING_PACKAGE_NAMES = new ArrayList(Arrays.asList(new String[]{"com.google.android.talk", "com.pansi.msg", "com.android.mms"}));
    private static final String TAG = MergedMessagesNotificationExtrator.class.getSimpleName();

    public MergedMessagesNotificationExtrator(PblNotification pblNotification, Context context) {
        super(pblNotification, context);
    }

    protected void extractContent() {
        super.extractContent();
        if (this.mPblNotification == null) {
            Trace.error(TAG, "Pebble Notification was null");
            return;
        }
        String tickerText = this.mPblNotification.getTickerText();
        String packageName = this.mPblNotification.getPackageName();
        if (tickerText != null && this.mContent.notificationTitle != null) {
            if ((packageName != null && packageName.equals("com.android.mms")) || !tickerText.contains(this.mContent.notificationTitle)) {
                String[] parts = this.mPblNotification.getTickerText().split(": ");
                if (parts.length > 1) {
                    Trace.debug(TAG, "Found Merged Messaging Notification: Building notification with Ticket Text");
                    this.mContent.notificationTitle = parts[0];
                    this.mContent.notificationBody = this.mPblNotification.getTickerText().substring(this.mContent.notificationTitle.length() + 2);
                }
            }
        }
    }
}
